$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'roadrunner'
require 'httparty'

get19Lou=RoadRunner.new do |session|
  session=
  {:adapter=>"mysql",
  :encoding=>"utf8",
  :database=>"dpmp",
  :username=>"root",
  :password=>"alisoft",
  :host=>"10.2.226.133"}
end
#get19Lou.mode = 'thread'

get19Lou.init do
  # users决定同时有多少并发用户一起执行action
  # iterations决定每个用户执行多少次
  get19Lou.users,get19Lou.iterations=10,10
end

get19Lou.action do
  get19Lou.homepage do
    resp = HTTParty.get('http://19lou.com')
    # => check request header if contain the certain key words
#    (resp.headers.inspect.include? 'Apache')
  end
  get19Lou.auto do
    resp = HTTParty.get('http://auto.19lou.com/')
    # => check request body
#    resp.body.include? '19lou'
  end
  true
end

get19Lou.run
get19Lou.report
get19Lou.save_report(:name=>"get19LouHomeAndSports2")